package liming.ai.deepseek.client;

import liming.ai.abstracts.client.AbstractClient;
import liming.ai.abstracts.client.AbstractRequest;
import liming.ai.deepseek.config.DeepSeekConfig;
import liming.ai.deepseek.message.DeepSeekMessage;
import org.json.JSONObject;

public class DeepSeekClient extends AbstractClient {
    public DeepSeekClient(DeepSeekResponseInterface responseInterface) {
        super(new DeepSeekRequest(), responseInterface,new DeepSeekConfig());
    }

    @Override
    public String chat(String query, AbstractRequest request, boolean save) {
        if(save){
            DeepSeekMessage deepSeekMessage = new DeepSeekMessage();
            deepSeekMessage.deserialize(new JSONObject().put("role","user").put("content",query));
            request.addMessage(deepSeekMessage);
        }
        return request.getMessageContext().getMessages().toString();
    }
}
